home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15470 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: grimsel.zurich.ibm.com!usenet
  2. From: wgk@zurich.ibm.com (Keith Whittingham)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Is this a memory leak?
  5. Date: 5 Apr 1996 18:16:14 GMT
  6. Organization: IBM Research, ZRH
  7. Message-ID: <4k3o1e$13gt@grimsel.zurich.ibm.com>
  8. References: <4jv214$gv7@insosf1.netins.net> <4k0c2i$h6e@werple.net.au> <31655281.78CB@datalytics.com>
  9. Reply-To: wgk@zurich.ibm.com
  10. NNTP-Posting-Host: pine.zurich.ibm.com
  11. X-Newsreader: IBM NewsReader/2 v1.00
  12.  
  13. In <31655281.78CB@datalytics.com>, Rob Stewart <stew@datalytics.com> writes:
  14. [snip]
  15. >There is also another question.  Why is top allocated on the 
  16. >heap?  I realize this is a short excerpt of code to illustrate 
  17. >something else, but this is a common thing.  You should avoid 
  18. >the heap whenever possible.  A heap allocation involves fairly 
  19. >lengthy operations, while a stack allocation involves a 
  20. >subtraction.  The result is higher performance.
  21.  
  22. And more stack overflows!
  23.  
  24. Personally I'd go for the lower performance, especially for code
  25. which is used by other people. I hate seeing > 4k of stack allocated
  26. for no good reason other than "It works that way".
  27.  
  28. The idea of undeterminable stack overflows in C/C++ code running in 
  29. nuclear power stations and jumbo jets scares the hell out of me.
  30.  
  31. At least Java's got this sorted out
  32.  
  33. Keith
  34.  
  35.